package zigzag.designpattern.proxy;

public class ProxyDisplay implements Image {
	private String filename;
	private Image img;
	private Image realImg;
	public ProxyDisplay(String filename){
		this.filename = filename;
	}
	public void displayImage(){
		if (img == null){
			img = new DummyImage(filename);
			realImg = new RealImage(filename);
		}else if (img instanceof  DummyImage){
			img = realImg;
		}
		img.displayImage();
	}

}
